
//
//  PDFReadFileJumper.m
//  BaxTer
//
//  Created by wsj2015 on 2016/11/2.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "PDFReadFileJumper.h"
#import "ReaderFileViewController.h"
#import "BTCourseModel.h"
#import "HYBBubbleTransition.h"

@implementation PDFReadFileJumper



+ (void)gotoPdfVCWith:(UIView *)cell withCourse:(BTCourseModel*)courseModel fromVC:(UIViewController *)oriVC toVC:(UIViewController *)toVC withBackBlock:(void(^)())backBlock{
    
    ReaderFileViewController *fileViewController = [[ReaderFileViewController alloc] init];
    //
    //
    fileViewController.title =courseModel.courseName;
 
    fileViewController.course = courseModel;
  
    fileViewController.modalPresentationStyle = UIModalPresentationFullScreen;

    fileViewController.callBack = ^(){
        
        //刷新当前页面
        backBlock();
    
    };
    
    /*
     测试代码
     */
    fileViewController.title = courseModel.courseName;
    
    /*
    
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:fileViewController];
    [navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    
    navigationController.navigationBar.translucent = YES;
    
    if ([[[UIDevice currentDevice] systemVersion] floatValue]>8.0) {
        navigationController.modalPresentationStyle = UIModalPresentationCustom;
        HYBBubbleTransition *bubbleTransition =[[HYBBubbleTransition alloc] initWithPresented:^(UIViewController *presented, UIViewController *presenting, UIViewController *source, HYBBaseTransition *transition) {
            // You need to cast type to the real subclass type.
            HYBBubbleTransition *bubble = (HYBBubbleTransition *)transition;
            
            // If you want to use Spring animation, set to YES.
            // Default is NO.
            //    bubble.animatedWithSpring = YES;
            bubble.bubbleColor = kMainColor;
            //                      bubble.animatedWithSpring = YES;
            // 由于一个控制器有导航，一个没有，导致会有64的误差
            CGPoint startPoint = [cell convertPoint:cell.center toView:oriVC.view];
            startPoint.y +=64;
            bubble.bubbleStartPoint = startPoint;
        } dismissed:^(UIViewController *dismissed, HYBBaseTransition *transition) {
            
            transition.transitionMode = kHYBTransitionDismiss;
        }];
        navigationController.transitioningDelegate = bubbleTransition;
        
    }
     测试代码
     */
    [oriVC presentViewController:fileViewController animated:YES completion:NULL];
    
    
    
}


@end
